@echo off
chcp 65001 >nul
setlocal enabledelayedexpansion

REM 设置颜色
set "RED=[91m"
set "GREEN=[92m"
set "YELLOW=[93m"
set "BLUE=[94m"
set "NC=[0m"

echo %GREEN%=== LikeAdmin Python Windows 部署工具使用示例 ===%NC%
echo.

echo %YELLOW%请选择操作模式:%NC%
echo %BLUE%1. 仅构建镜像 (build-images-only.bat)%NC%
echo %BLUE%2. 仅上传文件 (upload-only.bat)%NC%
echo %BLUE%3. 一键构建上传 (build-and-upload.bat)%NC%
echo %BLUE%4. 远程部署 (remote-deploy.bat)%NC%
echo %BLUE%5. 查看帮助信息%NC%
echo.

set /p "CHOICE=请输入选择 (1-5): "

if "%CHOICE%"=="1" goto :build_only
if "%CHOICE%"=="2" goto :upload_only
if "%CHOICE%"=="3" goto :build_upload
if "%CHOICE%"=="4" goto :remote_deploy
if "%CHOICE%"=="5" goto :help
goto :invalid_choice

:build_only
echo.
echo %GREEN%=== 仅构建镜像模式 ===%NC%
echo %YELLOW%使用方法: build-images-only.bat [版本号]%NC%
echo.
set /p "VERSION=请输入版本号 (留空使用时间戳): "
if "%VERSION%"=="" (
    echo %BLUE%将使用时间戳作为版本号%NC%
    call build-images-only.bat
) else (
    echo %BLUE%使用版本号: %VERSION%%NC%
    call build-images-only.bat %VERSION%
)
goto :end

:upload_only
echo.
echo %GREEN%=== 仅上传文件模式 ===%NC%
echo %YELLOW%使用方法: upload-only.bat [版本号] [服务器地址]%NC%
echo.
set /p "VERSION=请输入版本号: "
if "%VERSION%"=="" (
    echo %RED%版本号不能为空%NC%
    goto :end
)
set /p "SERVER=请输入服务器地址 (格式: 用户名@IP:路径): "
if "%SERVER%"=="" (
    echo %RED%服务器地址不能为空%NC%
    goto :end
)
echo %BLUE%版本号: %VERSION%%NC%
echo %BLUE%服务器: %SERVER%%NC%
call upload-only.bat %VERSION% %SERVER%
goto :end

:build_upload
echo.
echo %GREEN%=== 一键构建上传模式 ===%NC%
echo %YELLOW%使用方法: build-and-upload.bat [版本号] [服务器地址]%NC%
echo.
set /p "VERSION=请输入版本号: "
if "%VERSION%"=="" (
    echo %RED%版本号不能为空%NC%
    goto :end
)
set /p "SERVER=请输入服务器地址 (格式: 用户名@IP:路径): "
if "%SERVER%"=="" (
    echo %RED%服务器地址不能为空%NC%
    goto :end
)
echo %BLUE%版本号: %VERSION%%NC%
echo %BLUE%服务器: %SERVER%%NC%
call build-and-upload.bat %VERSION% %SERVER%
goto :end

:remote_deploy
echo.
echo %GREEN%=== 远程部署模式 ===%NC%
echo %YELLOW%使用方法: remote-deploy.bat [版本号] [服务器地址]%NC%
echo.
set /p "VERSION=请输入版本号: "
if "%VERSION%"=="" (
    echo %RED%版本号不能为空%NC%
    goto :end
)
set /p "SERVER=请输入服务器地址 (格式: 用户名@IP:路径): "
if "%SERVER%"=="" (
    echo %RED%服务器地址不能为空%NC%
    goto :end
)
echo %BLUE%版本号: %VERSION%%NC%
echo %BLUE%服务器: %SERVER%%NC%
call remote-deploy.bat %VERSION% %SERVER%
goto :end

:help
echo.
echo %GREEN%=== 帮助信息 ===%NC%
echo %YELLOW%脚本说明:%NC%
echo %BLUE%  build-images-only.bat - 构建Docker镜像并打包%NC%
echo %BLUE%  upload-only.bat - 上传文件到服务器%NC%
echo %BLUE%  build-and-upload.bat - 一键构建和上传%NC%
echo %BLUE%  remote-deploy.bat - 远程部署%NC%
echo.
echo %YELLOW%使用示例:%NC%
echo %BLUE%  构建镜像: build-images-only.bat v1.0.0%NC%
echo %BLUE%  上传文件: upload-only.bat v1.0.0 root@192.168.1.100:/opt/deploy%NC%
echo %BLUE%  一键操作: build-and-upload.bat v1.0.0 root@192.168.1.100:/opt/deploy%NC%
echo %BLUE%  远程部署: remote-deploy.bat v1.0.0 root@192.168.1.100:/opt/deploy%NC%
echo.
echo %YELLOW%注意事项:%NC%
echo %BLUE%  1. 确保Docker Desktop已启动%NC%
echo %BLUE%  2. 确保网络连接正常%NC%
echo %BLUE%  3. 确保服务器SSH服务正常%NC%
echo %BLUE%  4. 建议配置Docker镜像源加快下载%NC%
goto :end

:invalid_choice
echo %RED%无效选择，请输入 1-5%NC%
goto :end

:end
echo.
echo %GREEN%=== 操作完成 ===%NC%
pause 